package com.ly.designpatten.factory;

import com.ly.designpatten.factory.common.Pizza;


/**
 * @Classname Factory
 * @Description TODO
 * @Date 2020/10/7 13:52
 * @Author 冷心影翼
 */
public abstract class Factory {
	public abstract Pizza createPizza();

	public static void main(String[] args) {
		PizzaAFactory pizzaAFactory = new PizzaAFactory();
		PizzaBFactory pizzaBFactory = new PizzaBFactory();
		Pizza pizzaA = pizzaAFactory.createPizza();
		Pizza pizzaB = pizzaBFactory.createPizza();
	}
}

class PizzaAFactory extends Factory {

	@Override
	public Pizza createPizza() {

		return new PizzaB();
	}
}

class PizzaBFactory extends Factory {

	@Override
	public Pizza createPizza() {
		return new PizzaB();
	}
}
